package com.aiwiown.face;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * <pre>
 * </pre>
 * FaceProperties
 * Date: 2020/9/9 0009
 * Time: 10:05
 *
 * @author tang.xiaosheng@qq.com
 */
@Component
@ConfigurationProperties(com.aiwiown.face.FaceApiProperties.PREFIX)
public class FaceApiProperties implements InitializingBean {
    /**
     * Prefix of {@link com.aiwiown.face.FaceApiProperties}.
     */
    public static final String PREFIX = "face.api";
    /**
     * face api serverUrl
     */
    private String serverUrl;
    /**
     * face api AppKey,appId
     */
    private String appId;
    /**
     * face api appSecret
     */
    private String appSecret;
    /**
     * face api charset
     */
    private ApiConstants.Charset charset = ApiConstants.Charset.UTF8;
    /**
     * face api response format
     */
    private ApiConstants.Format format = ApiConstants.Format.JSON;
    /**
     * face api readOutTime
     */
    private Integer readOutTime = ApiConstants.READ_OUT_TIME;
    /**
     * face api connectTimeOut
     */
    private Integer connectTimeOut = ApiConstants.CONNECT_TIME_OUT;


    private static com.aiwiown.face.FaceApiProperties faceApiProperties;

    public static com.aiwiown.face.FaceApiProperties getFaceApiProperties() {
        return faceApiProperties;
    }

    public void afterPropertiesSet() throws Exception {
        faceApiProperties = this;
    }

    public String getServerUrl() {
        return serverUrl;
    }

    public void setServerUrl(String serverUrl) {
        this.serverUrl = serverUrl;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getAppSecret() {
        return appSecret;
    }

    public void setAppSecret(String appSecret) {
        this.appSecret = appSecret;
    }

    public ApiConstants.Charset getCharset() {
        return charset;
    }

    public void setCharset(ApiConstants.Charset charset) {
        this.charset = charset;
    }

    public ApiConstants.Format getFormat() {
        return format;
    }

    public void setFormat(ApiConstants.Format format) {
        this.format = format;
    }

    public Integer getReadOutTime() {
        return readOutTime;
    }

    public void setReadOutTime(Integer readOutTime) {
        this.readOutTime = readOutTime;
    }

    public Integer getConnectTimeOut() {
        return connectTimeOut;
    }

    public void setConnectTimeOut(Integer connectTimeOut) {
        this.connectTimeOut = connectTimeOut;
    }
}
